home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 3.4 KB | 107 lines | [TEXT/ToyS] |
- -- Needs Akua Sweets V1.29 or better
- property gasLastDate : 0
- global gasGC, gasDT
-
-
- on run
- set thisTime to the clock in offset form
-
- if (gasLastDate is 0) then
- set cpFold to (path to control panels folder) as string
- set cdFold to ((path to system folder) as string) & "Control Panels (Disabled):"
-
- set gasGC to 0
- set gasDT to 0
-
- set gcList to the entries in cpFold whose creators are in {"misc"}
- set dtList to the entries in cpFold whose creators are in {"time"}
- set gcLis2 to the entries in cdFold whose creators are in {"misc"}
- set dtLis2 to the entries in cdFold whose creators are in {"time"}
-
- if (gcLis2 is not {}) then set gasGC to (cdFold & (item 1 of gcLis2)) as alias
- if (dtLis2 is not {}) then set gasDT to (cdFold & (item 1 of dtLis2)) as alias
- if (gcList is not {}) then set gasGC to (cpFold & (item 1 of gcList)) as alias
- if (dtList is not {}) then set gasDT to (cpFold & (item 1 of dtList)) as alias
-
- set gasLastDate to thisTime
-
- else if (thisTime ≤ gasLastDate) then
-
- display dialog ("Du hast den PowerBook zu lange ohne Strom gelassen!" & ¬
- return & return & "Prüfe bitte den Datum- und Zeiteinstellungen.") ¬
- buttons {"Ja ja"} default button 1
- -- Open General Controls
- if gasGC is not 0 then ¬
- tell application "Finder" to open gasGC
- -- Open Date & Time
- if gasGC is not 0 then ¬
- tell application "Finder" to open gasDT
-
- else
- CheckDayLight()
- set gasLastDate to thisTime
- end if
- end run
-
-
-
-
- property kdtYearLong : 1 -- 1904-2020
-
- property kasTimeToSwitchOn : "0300" -- The time to switch on in 24 hour time
- property kasTimeToSwitchOff : "0200" -- The time to switch off in 24 hour time
-
- property kasDaylightOnEur : {-1, 1, 3, 0} -- Last Sunday in March (Europe)
- property kasDaylightOnUSA : {1, 1, 4, 0} -- First Sunday in April (USA)
- property kasDaylightOff : {-1, 1, 10, 0} -- Last Sunday in October (USA, Europe?)
-
-
- on CheckDayLight()
- -- Get current year
- set thisYear to (the clock using format kdtYearLong) as number
-
- -- Set year in our nth records (are we in Europe?)
- set greenwich to (time to GMT)
-
- -- Someone reported that this osax returned hours?!? Mine rerturns seconds
- if (greenwich < -24) or (greenwich > 24) then ¬
- set greenwich to greenwich / 3600 -- In hours
-
- -- Are we outside the USA?
- if (greenwich < -10) or (greenwich > -5) then
- set dstOn to kasDaylightOnEur
- else
- set dstOn to kasDaylighOnUSA
- end if
-
- -- I'm not sure of Europe's off time
- set dstOff to kasDaylightOff
-
- -- Insert current year
- set item 4 of dstOn to thisYear
- set item 4 of dstOff to thisYear
-
- -- Get dates for this year
- set thisYearOn to (the clock in sortable form using nth dstOn)
- set thisYearOff to (the clock in sortable form using nth dstOff)
- set thisYearNow to (the clock in extended sortable form)
-
- -- Add our setting hour to the On/Off dates
- set thisYearOn to thisYearOn & "." & kasTimeToSwitchOn
- set thisYearOff to thisYearOff & "." & kasTimeToSwitchOff
-
- -- Get current DST setting
- set ourLoc to (adjust the clock)
- set isOn to (daylight savings of ourLoc)
- set shouldBeOn to (thisYearNow ≥ thisYearOn) and (thisYearNow < thisYearOff)
-
- -- Need to switch?
- if (shouldBeOn is not isOn) then
- set daylight savings of ourLoc to shouldBeOn
- adjust the clock at geoposition ourLoc
- display dialog ("Daylight savings time adjustment has been performed for you.") ¬
- with icon note buttons {"Thankyou, Akua!"} default button 1 ¬
- -- giving up after 300 -- Only MacOS 8.51 or later
- end if
- end CheckDayLight
-